package demo01;

public class Chengxu09 {
	public static void main(String[] args) {
		for (int i = 0; i <= 1000; i++){
			if(isPerfectnum(i)){
				System.out.println(i);
			}
		}
	}

	private static boolean isPerfectnum(int num) {
		int sum = 0;
		for (int i = 1; i <= num / 2; i++){
			if(num % i == 0){
				sum = sum + i;
			}
		}
		return sum == num;
	}
}
